<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     default_iphone
 * @copyright   Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Customer login form template
 *
 * @see app/design/frontend/base/default/template/customer/form/login.phtml
 */
/** @var $this Mage_Customer_Block_Form_Login */
?>
<div class="account-login">

    <?php echo $this->getMessagesBlock()->toHtml() ?>
    <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form" autocomplete="off">
    <input style="display:none" type="text" name="fakeusernameremembered"/>
    <input style="display:none" type="password" name="fakepasswordremembered"/>
        <?php echo $this->getBlockHtml('formkey') ?>
        <div class="col2-set">
            <div class="col-1 registered-users" style="height: inherit;">
                <div class="content">

                    <ul class="form-list">
                        <li>

                            <div class="input-box input-log input-bor">
                                <!--<img src="<?php //echo $this->getSkinUrl('images/01-9-login_03.png') ?>" alt=""/>-->
                                <label>账号</label>
                                <input id="validate-phone" placeholder="<?php echo $this->__('手机号码/用户名') ?>" type="text" name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>"  class="input-text required-entry" title="<?php echo $this->__('iphone') ?>" autocomplete="off"/>
                            </div>
                        </li>
                        <li>

                            <div class="input-box input-log">
                                <!--<img src="<?php //echo $this->getSkinUrl('images/01-9-login_06.png') ?>" alt=""/>-->
                                <label>密码</label>
                                <input id="validate-psd" placeholder="<?php echo $this->__('请输入登录密码') ?>" type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" autocomplete="off"/>
                            </div>
                        </li>

                        <?php echo $this->getChildHtml('form.additional.info'); ?>
                        <?php echo $this->getChildHtml('persistent.remember.me'); ?>

                    </ul>

                    <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
                </div>
            </div>
            <div class="buttons-set">
                <input type="hidden" name="referer" value="<?php echo $this->getRequest()->getParam('referer') ?>" />
                <button  type="submit" title="<?php echo $this->__('Login') ?>" class="button login-btn"  name="send" id="send2"><span><span><?php echo $this->__('登录') ?></span></span></button>
                <a class="forgot-psd" href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('找回密码') ?></a>
            </div>
        </div>
        <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
            <input name="context" type="hidden" value="checkout" />
        <?php endif; ?>
    </form>
    <script type="text/javascript">
    //<![CDATA[
    var dataForm = new VarienForm('login-form', true);
    //]]>
    var websiteUrl = '<?php echo $this->getUrl('zgb/ajax/website');?>';
    jQuery(function($){
        $(function(){
            $("#send2").attr({"disabled":"disabled"});
            if ($(".error-msg")) {$("#send2").removeAttr("disabled");};
            $("#validate-phone").change(function(){
                var username = $(this).val();
                $.get(websiteUrl,{"username":username},function(data){
                    if(data){
                        $("#send2").removeAttr("disabled");
                    }else{
                        $("#send2").attr({"disabled":"disabled"});
                        layer.open({
                            content:"当前用户不存在！",
                            style:"font-size:0.16rem;font-family: 'Microsoft YaHei', Arial, Helvetica, sans-serif;",
                            time:1,
                        })
                    }
                })
            });
        })
    })
    </script>
</div>
